/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package kimo.persistence.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author a381u296
 */
@Entity
@Table(name = "adt_type")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "AdtType.findAll", query = "SELECT a FROM AdtType a"),
    @NamedQuery(name = "AdtType.findByAdtTypeId", query = "SELECT a FROM AdtType a WHERE a.adtTypeId = :adtTypeId"),
    @NamedQuery(name = "AdtType.findByAdtTypeName", query = "SELECT a FROM AdtType a WHERE a.adtTypeName = :adtTypeName")})
public class AdtType implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "adt_type_id")
    private Integer adtTypeId;
    @Basic(optional = false)
    @Column(name = "adt_type_name")
    private String adtTypeName;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "producerAdtTypeId")
    private List<Producer> producerList;

    public AdtType() {
    }

    public AdtType(Integer adtTypeId) {
        this.adtTypeId = adtTypeId;
    }

    public AdtType(Integer adtTypeId, String adtTypeName) {
        this.adtTypeId = adtTypeId;
        this.adtTypeName = adtTypeName;
    }

    public Integer getAdtTypeId() {
        return adtTypeId;
    }

    public void setAdtTypeId(Integer adtTypeId) {
        this.adtTypeId = adtTypeId;
    }

    public String getAdtTypeName() {
        return adtTypeName;
    }

    public void setAdtTypeName(String adtTypeName) {
        this.adtTypeName = adtTypeName;
    }

    @XmlTransient
    public List<Producer> getProducerList() {
        return producerList;
    }

    public void setProducerList(List<Producer> producerList) {
        this.producerList = producerList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (adtTypeId != null ? adtTypeId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AdtType)) {
            return false;
        }
        AdtType other = (AdtType) object;
        if ((this.adtTypeId == null && other.adtTypeId != null) || (this.adtTypeId != null && !this.adtTypeId.equals(other.adtTypeId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return adtTypeName;
    }
    
}
